﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq.Mapping;

namespace Argos.Data.Model
{
	/// <summary>
	/// Represents a group of alert recipients.
	/// </summary>
	[Serializable]
	public class RecipientGroup : ItemBase
	{

		#region public string Description { get; set; }

		private static string DescriptionPropertyName = "Description";

		/// <summary>
		/// Sets or returns the description of the group.
		/// </summary>
		public string Description
		{
			get { return this.GetProperty<string>(DescriptionPropertyName); }
			set { this.SetProperty(DescriptionPropertyName, value); }
		}

		#endregion

		#region public string Name { set; set; }

		private static string NamePropertyName = "Name";

		/// <summary>
		/// Sets or returns the name of the group.
		/// </summary>
		public string Name
		{
			get { return this.GetProperty<string>(NamePropertyName); }
			set { this.SetProperty(NamePropertyName, value); }
		}

		#endregion

		#region public IList<Recipient> Members { get; }

		private static string MembersPropertyName = "Members";

		/// <summary>
		/// Returns the members of the group.
		/// </summary>
		public IList<Recipient> Members
		{
			get
			{
				IList<Recipient> m = this.GetProperty<IList<Recipient>>(MembersPropertyName);
				if (null == m)
				{
					m = new List<Recipient>();
				}
				return m;
			}
		}

		#endregion

	}
}
